package com.hu.mapper;

import com.hu.pojo.Music;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

//这个注解表明是mybatis的mapper类:Dao层
@Mapper
@Repository
public interface MusicMapping {
    int addMusic(Music music);
    int deleteMusic(int id);
    int updateMusic(Music music);
    Music queryById(int id);

    List<Music> queryAll();

    int insertPlayRecord(@Param("musicId")Integer musicId,@Param("userId") Integer userId,@Param("playTime") Date playTime);

    List<Music> queryByPlayRecord(Integer userId);

    List<Music> queryByPlayNum();

    List<Music> queryByLikeNum();

    List<Music> queryByType(String type);

    void addMusicLike(@Param("userId") Integer userId,@Param("musicId") Integer musicId);

    void deleteMusicLike(@Param("userId")Integer userId, @Param("musicId")Integer musicId);

    List<Music> queryByMyLike(Integer userId);

    List<Music> queryByMyMusicList(Integer userId);

    List<Music> queryByMusicListId(Integer musicListId);

    void deleteByMusicList(@Param("musicId")Integer musicId, @Param("musicListId")Integer musicListId);

    List<Object> queryLike(@Param("userId")Integer userId, @Param("musicId")Integer musicId);

    void insertByMusicList(Integer musicId, Integer musicListId);

    List<Music> excutesql(String sql);
}
